UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j0uFUa5gqAjDjkptYgvsfn1wePgxuc5BNvgoTEu7y+M=' 
WHERE 
  key_id = 'e875cc4995a59c3ae618522101a4c94fbf382585df2404e652c334f9b9d7d421' 
  AND (
    token = 'j0uFUa5gqAjDjkptYgvsfn1wePgxuc5BNvgoTEu7y+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044