UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9r9dx1LpEWJ1+PlSlGqlrI20tf+K+8Pjj7B9750MKc=' 
WHERE 
  key_id = '585a5a7623ba474cbba491a49af56008475814bd8c388225b81c8f32fed38848' 
  AND (
    token = 'q9r9dx1LpEWJ1+PlSlGqlrI20tf+K+8Pjj7B9750MKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031