UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TcGstLS5DZUX5gcisuj6V35gT43P74ZG+2TrrFErZ4U=' 
WHERE 
  key_id = 'b506a90bd1c849cba7cb10727897c065b72745b49cb9af393e75b27ddcea918d' 
  AND (
    token = 'TcGstLS5DZUX5gcisuj6V35gT43P74ZG+2TrrFErZ4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022