UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6ofpwZ1UGj1dZeHyw4kBIkTEPDMDgOEGeh7Z/RZwEg=' 
WHERE 
  key_id = 'a4071495247943bfb25f6983f55a6d5f76db7d35f4e2c033c9fe5583a07c5a53' 
  AND (
    token = 'K6ofpwZ1UGj1dZeHyw4kBIkTEPDMDgOEGeh7Z/RZwEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025