UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4GJ4lj7LtIMXTA1p2uTJVA9D27OFAv8Y36XQ1BW3dL8=' 
WHERE 
  key_id = '5701f0fb38260a7828099769191d0b22156f20bda18379ca2c4754f925b93bde' 
  AND (
    token = '4GJ4lj7LtIMXTA1p2uTJVA9D27OFAv8Y36XQ1BW3dL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040