UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mW2wyvYUh/wdvOisD5ayenNrCiHE5FwuiZxuDM5Pd2I=' 
WHERE 
  key_id = '779778970586b242a9ab5bf4b3afc0ad9188e622f7464926d5d5e0f6d818dd3e' 
  AND (
    token = 'mW2wyvYUh/wdvOisD5ayenNrCiHE5FwuiZxuDM5Pd2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028