UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+VUABm0vul50RffTN94oKvWIZZ4XQZ2qDi30+DLuj0=' 
WHERE 
  key_id = '6e0045fb5cad31464a4742215f6a0228bb7ee5b11e278563be7ddee7f9cdf138' 
  AND (
    token = 'k+VUABm0vul50RffTN94oKvWIZZ4XQZ2qDi30+DLuj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036