UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b+HiOfAPV6YmIXGRAJocgTNKTe5wg1/L8sJ2EAZI5BQ=' 
WHERE 
  key_id = '2ae332489471abe00b8be4fe2e61d182223c2a752d2285fe38a734e22ceae24f' 
  AND (
    token = 'b+HiOfAPV6YmIXGRAJocgTNKTe5wg1/L8sJ2EAZI5BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037