UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a+nokHA71AydVV+iUy6cN9uCChphZJs7KAAEgjKnB1M=' 
WHERE 
  key_id = '6ed8e9e56029b48263c470222b19b363a027995f2f870489c1442b4e3cbcbdbe' 
  AND (
    token = 'a+nokHA71AydVV+iUy6cN9uCChphZJs7KAAEgjKnB1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033