UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WkOAw5ehCYzLudHCNSdpLQ+D/C6R1MlCPJ2eFoCI0bg=' 
WHERE 
  key_id = '1662c4637b453fb51eb60f71470f064841d78ea9b4b1db9503d6375f73b3a5f3' 
  AND (
    token = 'WkOAw5ehCYzLudHCNSdpLQ+D/C6R1MlCPJ2eFoCI0bg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021