UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oqRB8FLokadQL4F8y36J+3mozGKki3IV+FVdpOUHSeE=' 
WHERE 
  key_id = 'c6ebed236a2254841112d812978c4f435fa7b991a86e59be47b9a79724b8e3d2' 
  AND (
    token = 'oqRB8FLokadQL4F8y36J+3mozGKki3IV+FVdpOUHSeE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032