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

Query time 0.00024