UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kscYheJdRxoD0mHw7xjvTy3WeX9WQCZ3RW5bghTiRho=' 
WHERE 
  key_id = '727298b73189f44346745df88c89be982c99b951caeaedeebc2a11a3c1d6b147' 
  AND (
    token = 'kscYheJdRxoD0mHw7xjvTy3WeX9WQCZ3RW5bghTiRho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022