UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twcBgp/KNoX8eXUn9R9YeiX5iPA/U/6ny9eEGs/qDBQ=' 
WHERE 
  key_id = '2a7fa514d99434966c3f87d47becf201519507dd32fa0ff566f35611c9221742' 
  AND (
    token = 'twcBgp/KNoX8eXUn9R9YeiX5iPA/U/6ny9eEGs/qDBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020