UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hp1vL1idyuXuwfULEZxbR9HC4nmrawmBrJ7NJs6Bmtk=' 
WHERE 
  key_id = 'fb3308af0a8b388e6fae85d8280a6a1639dcbf89a51df3707135eefb2198d883' 
  AND (
    token = 'hp1vL1idyuXuwfULEZxbR9HC4nmrawmBrJ7NJs6Bmtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039