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

Query time 0.00045