UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gnKyJihOP1l7YUpvwa/eR/dcziTEM4Nxz2SNfWqFIMM=' 
WHERE 
  key_id = '09c89cc908a7bf9914687796638f8270fc5dd303e6c7f1b3b0dad62908fdf227' 
  AND (
    token = 'gnKyJihOP1l7YUpvwa/eR/dcziTEM4Nxz2SNfWqFIMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032