UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWMd51pcuwdWy+CRKZCJJWmr/21iGPXDL5ih7gxpHFc=' 
WHERE 
  key_id = '5eb05b796d4d8adc2d148eee4c0a6484d017d4d2284748085abddc0972408537' 
  AND (
    token = 'qWMd51pcuwdWy+CRKZCJJWmr/21iGPXDL5ih7gxpHFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029