UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgHArXchj8jn22HukrMYKnJ24ITXSQSVxqOF64lk7sA=' 
WHERE 
  key_id = '583bade39bd04b471c0382842d043e82b0269d34e6c232f00c6f66d32c91175f' 
  AND (
    token = 'rgHArXchj8jn22HukrMYKnJ24ITXSQSVxqOF64lk7sA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033