UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rwtXhzLAWWM3l2OpLKUefaJIm3M0X8EJWdk1t49+UPQ=' 
WHERE 
  key_id = 'f8ffa740a9032f0d1e5e59004e87d936d45a7d2b7b9b1a1a0bb09528636cbf27' 
  AND (
    token = 'rwtXhzLAWWM3l2OpLKUefaJIm3M0X8EJWdk1t49+UPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033