UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7OpD7OIOWX/1LZTdMy1SwFDtSaibrNk/ValqsEZpZo=' 
WHERE 
  key_id = '28b211d5ad44900fc1c112414f109d18bd9e87dee06ab162f3bcb547327d5764' 
  AND (
    token = 'J7OpD7OIOWX/1LZTdMy1SwFDtSaibrNk/ValqsEZpZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031