UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/T53DuBqHIokF4Aa1DAUQKAvy9scUkP+jya2+A/3fCs=' 
WHERE 
  key_id = '8cf17e4c002904c633fc80d4ae39e8854f5cb19ac1d0037c145a72b76056736d' 
  AND (
    token = '/T53DuBqHIokF4Aa1DAUQKAvy9scUkP+jya2+A/3fCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039