UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kxR4GyI4OQy/rbG/Cbxo7sTnV3pBCfWX+/l4Qcdh8dQ=' 
WHERE 
  key_id = '638160e4bf91293772161fd12b7f5a5e2f01504731c423347f9843f887317bad' 
  AND (
    token = 'kxR4GyI4OQy/rbG/Cbxo7sTnV3pBCfWX+/l4Qcdh8dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027