UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZczMsPI28ayfou3JFzoPgZSFnMughmtUR+SUKznLuU=' 
WHERE 
  key_id = '6bca618349392fe35406c0b5bdcde843ed12035f3e0b76316bdc291de8082d0c' 
  AND (
    token = 'YZczMsPI28ayfou3JFzoPgZSFnMughmtUR+SUKznLuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027