UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v0530+a1sJd2BILo+na0eXA7D53zRiDbiVCHkID5Zfc=' 
WHERE 
  key_id = '25bc53963f07a273d428077bba64aa929c9c1b5616465c05fe298480e24207b4' 
  AND (
    token = 'v0530+a1sJd2BILo+na0eXA7D53zRiDbiVCHkID5Zfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066