UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oiPcPMjVNPqv2wUqrvNrAD7KVgUVwT+82LtNgRhJeTA=' 
WHERE 
  key_id = 'f00acdff2187ef90a7bf5b70a0b48e981f83d481799dbb57012928d333453551' 
  AND (
    token = 'oiPcPMjVNPqv2wUqrvNrAD7KVgUVwT+82LtNgRhJeTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040