UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5soKWcCQvVcvtjzwN+1CZapL4uIneULnCQkpMDmzb6Y=' 
WHERE 
  key_id = '3434da06dd7c502f969cfd95e284cbbdd35d298eb1f55e659e2c8de0f587c014' 
  AND (
    token = '5soKWcCQvVcvtjzwN+1CZapL4uIneULnCQkpMDmzb6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025