UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rSlSGUdur4dy81ZnKB8tF5mn8J9NUpSzeCYjEuB+nqk=' 
WHERE 
  key_id = '332272c5ac791cda55bdcb99fd217443708de84c776e31a868adfbe8083103b6' 
  AND (
    token = 'rSlSGUdur4dy81ZnKB8tF5mn8J9NUpSzeCYjEuB+nqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031