UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'COJnUsBYcnIjTLQK7YgM+860+8rcn2wjPsB9CaNijwo=' 
WHERE 
  key_id = 'f0e2b2b172e2aac89b301583aa8c0525af083f601eaac40d8f3e30a63f0eb0a7' 
  AND (
    token = 'COJnUsBYcnIjTLQK7YgM+860+8rcn2wjPsB9CaNijwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039