UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sBbp8J5c13LigghX6d4KqF7fPIVaCzVQ9x9SrKmKUaE=' 
WHERE 
  key_id = 'ed401eaa78a2b2c4258557249b551d3c491666044d8520dd33508b367a241615' 
  AND (
    token = 'sBbp8J5c13LigghX6d4KqF7fPIVaCzVQ9x9SrKmKUaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041